<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../assets/css/bootstrap.min.css" />
    <script src="../assets/js/jquery.min.js"></script>
    <script src="../assets/js/bootstrap.min.js"></script>
    <title>修改商品类型</title>
</head>
<body>
<div style="width:98%;margin-left: 1%;">
    <div class="panel panel-default">
        <div class="panel-heading">
            修改商品类型
        </div>
        <div class="panel-body">
<!--            改这里-->
            <form action="showGoodsType.php" method="post">
                <div class="row">
                    <div class="form-group form-inline">
                        <span>种类名称</span>
<!--                        设置value的默认值-->
                        <input type="text" name="name" class="form-control" value="<?php echo $_GET['name']?>">
                    </div>
                </div>
                <div class="row">
                    <div class="form-group form-inline">
                        <span>种类等级</span>
                        <input type="text" name="level" class="form-control" value="<?php echo $_GET['level']?>">
                    </div>
                </div>
                <div class="row">
                    <div class="btn-group">
                        <button type="reset" class="btn btn-default">清空</button>
<!--                        改这里-->
                        <button onclick="onRequest()" class="btn btn-default">修改</button>
                    </div>
                </div>
            </form>
            <p style="color:red"></p>
        </div>
    </div>
</div>

<script>
    function onRequest(){
        var name = $("input[name='name']").val();
        var level = $("input[name='level']").val();
        $.ajax({
            async: false,
            url: "http://localhost:80/phalapi/public/index.php?s=App.GoodsType.updateGoodsTypeInfo",
            type: "POST",
            data : {
                goodType_name:name,
                level:level,
                goodType_parentName:'',
                goodType_id:<?php echo $_GET['id']?>
            },
            dataType: "JSON",
            success: function (result) {
                var user_data = result.data.info;
                console.log("data:" + user_data)

            },
            error: function (msg) {
                alert("错误信息：" + msg);
            }
        })
    }
</script>

</body>
</html>